import { request } from '@/api/REQ'
/* 查看方案 */
export function get(projectId: number, parameter: object) {
	return request({
		url: `/solution/${projectId}`,
		method: 'get',
		params: parameter,
	})
}
// 获取方案详细指标
export function solutionIndicators(solution_id: number) {
	return request({
		url: `/indicator/${solution_id}`,
		method: 'get',
	})
}
// 更新方案详细指标
export function updateIndicators(solution_id: number, data: any) {
	return request({
		url: `/indicator/${solution_id}`,
		method: 'post',
		data: data,
	})
}
/* 增加方案 */
export function add(data: object) {
	return request({
		url: `/solution`,
		method: 'post',
		data: data,
	})
}
/* 更新方案 */
export function update(data: object) {
	return request({
		url: `/solution/update`,
		method: 'post',
		data: data,
	})
}
/* 删除方案 */
export function del(solutionId: number) {
	return request({
		url: `/solution/${solutionId}`,
		method: 'delete',
	})
}
/* 方案评估 */
export function eva(solutionId: number) {
	return request({
		url: `/solution/evaluate/${solutionId}/4`,
		method: 'get',
	})
}

/* 敏感性分析 */
export function analyse(solutionId: number, data: any) {
	return request({
		url: `/solution/analyze/${solutionId}/4`,
		method: 'post',
		data: data,
	})
}
/* 获取表格标题 */
export function tables(solutionId: number) {
	return request({
		url: `/solution/evaluate/${solutionId}`,
		method: 'get',
	})
}

/* 方案比选 */
export function compare(data: Array<number>) {
	return request({
		url: `/indicator/compare`,
		method: 'post',
		data: data,
	})
}

// 修改方案详细指标
export function addIndicator(
	solution_id: number,
	indicator_mark: string,
	indicator_name: string
) {
	return request({
		url: `/indicator/addIndicator/${solution_id}&${indicator_mark}&${indicator_name}`,
		method: 'get',
	})
}
// 复制方案
export function copy(solution_id: number) {
	return request({
		url: `/solution/copy/${solution_id}`,
		method: 'post',
	})
}
export default {
	get,
	add,
	update,
	del,
	eva,
	copy,
	analyse,
	solutionIndicators,
	updateIndicators,
	addIndicator,
	compare,
}
